package com.example.demo.pojos;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

@Entity
public class Xsjhlxinfo {
    private int xsjhlxId;
    private String xsjhlxName;
    private String qy;
    private List<Xsjhinfo> xsjh;

    @Id
    @Column(name = "xsjhlxId", nullable = false)
    public int getXsjhlxId() {
        return xsjhlxId;
    }

    public void setXsjhlxId(int xsjhlxId) {
        this.xsjhlxId = xsjhlxId;
    }

    @Basic
    @Column(name = "xsjhlxName", nullable = true, length = 20)
    public String getXsjhlxName() {
        return xsjhlxName;
    }

    public void setXsjhlxName(String xsjhlxName) {
        this.xsjhlxName = xsjhlxName;
    }

    @Basic
    @Column(name = "qy", nullable = true, length = 2)
    public String getQy() {
        return qy;
    }

    public void setQy(String qy) {
        this.qy = qy;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Xsjhlxinfo that = (Xsjhlxinfo) o;
        return xsjhlxId == that.xsjhlxId &&
                Objects.equals(xsjhlxName, that.xsjhlxName) &&
                Objects.equals(qy, that.qy);
    }

    @Override
    public int hashCode() {
        return Objects.hash(xsjhlxId, xsjhlxName, qy);
    }

    @OneToMany(mappedBy = "xsjhlx")
    public List<Xsjhinfo> getXsjh() {
        return xsjh;
    }

    public void setXsjh(List<Xsjhinfo> xsjh) {
        this.xsjh = xsjh;
    }
}
